(function($){
	// Settings
	
	var repeat = localStorage.repeat || 0,
		shuffle = localStorage.shuffle || 'false',
		continous = true,
		autoplay = false,
		playlist = [
			{
				title: '全部都是你',
				artist: '全部都是你',
				album: 'Dragon Pig - 全部都是你_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/Dragon Pig - 全部都是你_clip.mp3'
			},
			{
				title: '当',
				artist: '当',
				album: 'TFBOYS - 当 (Live)_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/TFBOYS - 当 (Live)_clip.mp3'
			},
			{
				title: '最浪漫的事',
				artist: '最浪漫的事',
				album: '阿木 - 最浪漫的事_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/阿木 - 最浪漫的事_clip.mp3'
			},
			{
				title: '相约九八',
				artist: '相约九八',
				album: '鞍安 - 相约九八_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/鞍安 - 相约九八_clip.mp3'
			},
			{
				title: '奔跑',
				artist: '奔跑',
				album: '部落组合 - 奔跑_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/部落组合 - 奔跑_clip.mp3'
			},{
				title: '红色高跟鞋',
				artist: '红色高跟鞋',
				album: '蔡健雅 - 红色高跟鞋_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/蔡健雅 - 红色高跟鞋_clip.mp3'
			},
			{
				title: '明月几时有',
				artist: '明月几时有',
				album: '蔡琴 - 明月几时有_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/蔡琴 - 明月几时有_clip.mp3'
			},
			{
				title: '夜上海',
				artist: '夜上海',
				album: '蔡琴 - 夜上海_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/蔡琴 - 夜上海_clip.mp3'
			},
			{
				title: '海阔天空',
				artist: '海阔天空',
				album: '曹格 - 海阔天空 (Live)_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/曹格 - 海阔天空 (Live)_clip.mp3'
			},
			{
				title: '心太软',
				artist: '心太软',
				album: '陈慧琳 - 心太软_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/陈慧琳 - 心太软_clip.mp3'
			},{
				title: '童话镇',
				artist: '童话镇',
				album: '陈一发儿 - 童话镇_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/陈一发儿 - 童话镇_clip.mp3'
			},
			{
				title: '因为爱情 ',
				artist: '因为爱情 ',
				album: '陈奕迅 - 因为爱情 (Live)_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/陈奕迅 - 因为爱情 (Live)_clip.mp3'
			},
			{
				title: '难忘今宵',
				artist: '难忘今宵',
				album: '华语群星 - 难忘今宵 (Live)_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/华语群星 - 难忘今宵 (Live)_clip.mp3'
			},
			{
				title: '功夫瑜伽',
				artist: '功夫瑜伽',
				album: '成龙 - 功夫瑜伽_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/成龙 - 功夫瑜伽_clip.mp3'
			},
			{
				title: '国家',
				artist: '国家',
				album: '成龙 - 国家_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/成龙 - 国家_clip.mp3'
			},
			{
				title: '难忘今宵',
				artist: '难忘今宵',
				album: '华语群星 - 难忘今宵 (Live)_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/华语群星 - 难忘今宵 (Live)_clip.mp3'
			},
			{
				title: '难说再见',
				artist: '难说再见',
				album: '成龙 - 难说再见_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/成龙 - 难说再见_clip.mp3'
			},
			{
				title: '倍儿爽',
				artist: '倍儿爽',
				album: '大张伟 - 倍儿爽_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/大张伟 - 倍儿爽_clip.mp3'
			},
			
			{
				title: '有多少爱可以重来',
				artist: '有多少爱可以重来',
				album: '迪克牛仔 - 有多少爱可以重来_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/迪克牛仔 - 有多少爱可以重来_clip.mp3'
			},
			{
				title: '健康歌',
				artist: '健康歌',
				album: '儿歌 - 健康歌_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/儿歌 - 健康歌_clip.mp3'
			},
			{
				title: '特别的人',
				artist: '特别的人',
				album: '方大同 - 特别的人_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/方大同 - 特别的人_clip.mp3'
			},
			{
				title: '小方',
				artist: '小方',
				album: '方大同 - 小方_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/方大同 - 小方_clip.mp3'
			},
			{
				title: '千里之外',
				artist: '千里之外',
				album: '费玉清 - 千里之外 (Live)_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/费玉清 - 千里之外 (Live)_clip.mp3'
			},
			{
				title: '难忘今宵',
				artist: '难忘今宵',
				album: '华语群星 - 难忘今宵 (Live)_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/华语群星 - 难忘今宵 (Live)_clip.mp3'
			},
			{
				title: '什么都不必说',
				artist: '什么都不必说',
				album: '费玉清 - 什么都不必说 (Live)_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/费玉清 - 什么都不必说 (Live)_clip.mp3'
			},
			{
				title: '一剪梅',
				artist: '一剪梅',
				album: '费玉清 - 一剪梅_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/费玉清 - 一剪梅_clip.mp3'
			},
			{
				title: '天路',
				artist: '天路',
				album: '韩红 - 天路 (传统版)_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/韩红 - 天路 (传统版)_clip.mp3'
			},
			{
				title: '再回首',
				artist: '再回首',
				album: '郝蕾 - 再回首_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/郝蕾 - 再回首_clip.mp3'
			},
			{
				title: '同桌的你',
				artist: '同桌的你',
				album: '胡夏 - 同桌的你_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/胡夏 - 同桌的你_clip.mp3'
			},
			{
				title: '难忘今宵',
				artist: '难忘今宵',
				album: '华语群星 - 难忘今宵 (Live)_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/华语群星 - 难忘今宵 (Live)_clip.mp3'
			},
			{
				title: '浮夸 ',
				artist: '浮夸 ',
				album: '华晨宇 - 浮夸 (Live)_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/华晨宇 - 浮夸 (Live)_clip.mp3'
			},
			{
				title: '后来',
				artist: '后来',
				album: '华语群星 - 后来_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/华语群星 - 后来_clip.mp3'
			},
			{
				title: '难忘今宵',
				artist: '难忘今宵',
				album: '华语群星 - 难忘今宵 (Live)_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/华语群星 - 难忘今宵 (Live)_clip.mp3'
			},
			{
				title: '难忘今宵',
				artist: '难忘今宵',
				album: '华语群星 - 难忘今宵 (Live)_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/ - 难忘今宵 (Live)_clip.mp3'
			},
			{
				title: '最浪漫的事',
				artist: '最浪漫的事',
				album: '华语群星 - 最浪漫的事_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/华语群星 - 最浪漫的事_clip.mp3'
			},
			{
				title: '水手',
				artist: '水手',
				album: '黄渤 - 水手 (改编版)_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/黄渤 - 水手 (改编版)_clip.mp3'
			},
			{
				title: '九妹',
				artist: '九妹',
				album: '黄鹤翔 - 九妹_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/黄鹤翔 - 九妹_clip.mp3'
			},
			
			{
				title: '老男孩',
				artist: '老男孩',
				album: '筷子兄弟 - 老男孩 (Live)_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/筷子兄弟 - 老男孩 (Live)_clip.mp3'
			},
			{
				title: '小苹果',
				artist: '小苹果',
				album: '筷子兄弟 - 小苹果 (Live)_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/筷子兄弟 - 小苹果 (Live)_clip.mp3'
			},
			{
				title: '同桌的你',
				artist: '同桌的你',
				album: '老狼 - 同桌的你_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/老狼 - 同桌的你_clip.mp3'
			},
			{
				title: '我要你',
				artist: '我要你',
				album: '老狼 - 我要你_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/老狼 - 我要你_clip.mp3'
			},
			{
				title: '漂洋过海来看你 ',
				artist: '漂洋过海来看你 ',
				album: '李美熹 - 漂洋过海来看你 (Live)_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/李美熹 - 漂洋过海来看你 (Live)_clip.mp3'
			},
			{
				title: '山路十八弯',
				artist: '山路十八弯',
				album: '李琼 - 山路十八弯_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/李琼 - 山路十八弯_clip.mp3'
			},
			{
				title: '刚好遇见你',
				artist: '刚好遇见你',
				album: '李玉刚 - 刚好遇见你_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/李玉刚 - 刚好遇见你_clip.mp3'
			},
			{
				title: '新贵妃醉酒',
				artist: '新贵妃醉酒',
				album: '李玉刚 - 新贵妃醉酒_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/李玉刚 - 新贵妃醉酒_clip.mp3'
			},
			{
				title: '难忘今宵',
				artist: '难忘今宵',
				album: '华语群星 - 难忘今宵 (Live)_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/华语群星 - 难忘今宵 (Live)_clip.mp3'
			},
			{
				title: '当你',
				artist: '当你',
				album: '林俊杰 - 当你_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/林俊杰 - 当你_clip.mp3'
			},
			{
				title: '江南',
				artist: '江南',
				album: '林俊杰 - 江南_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/林俊杰 - 江南_clip.mp3'
			},
			{
				title: '理想三旬',
				artist: '理想三旬',
				album: '刘安琪 - 理想三旬_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/刘安琪 - 理想三旬_clip.mp3'
			},
			{
				title: '练习',
				artist: '练习',
				album: '刘德华 - 练习 (Live)_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/刘德华 - 练习 (Live)_clip.mp3'
			},
			{
				title: '好汉歌',
				artist: '好汉歌',
				album: '刘欢 - 好汉歌_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/刘欢 - 好汉歌_clip.mp3'
			},
			{
				title: '我和你',
				artist: '我和你',
				album: '刘欢 - 我和你_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/刘欢 - 我和你_clip.mp3'
			},
			{
				title: '听说',
				artist: '听说',
				album: '刘若英 - 听说_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/刘若英 - 听说_clip.mp3'
			},
			{
				title: '那就这样吧',
				artist: '那就这样吧',
				album: '刘雨潼 - 那就这样吧 (Live)_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/刘雨潼 - 那就这样吧 (Live)_clip.mp3'
			},
			{
				title: '沧海一声笑',
				artist: '沧海一声笑',
				album: '罗大佑 - 沧海一声笑_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/罗大佑 - 沧海一声笑_clip.mp3'
			},
			{
				title: '感觉自己是巨星',
				artist: '感觉自己是巨星',
				album: '毛不易 - 感觉自己是巨星_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/毛不易 - 感觉自己是巨星_clip.mp3'
			},
			{
				title: '无问',
				artist: '无问',
				album: '毛不易 - 无问_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/毛不易 - 无问_clip.mp3'
			},
			{
				title: '消愁',
				artist: '消愁',
				album: '毛不易 - 消愁 (铃声)_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/毛不易 - 消愁 (铃声)_clip.mp3'
			},
			{
				title: '女人花 ',
				artist: '女人花 ',
				album: '梅艳芳 - 女人花 (Live)_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/梅艳芳 - 女人花 (Live)_clip.mp3'
			},
			{
				title: '亲密爱人',
				artist: '亲密爱人',
				album: '梅艳芳 - 亲密爱人_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/梅艳芳 - 亲密爱人_clip.mp3'
			},
			{
				title: '相爱很难',
				artist: '相爱很难',
				album: '梅艳芳 - 相爱很难_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/梅艳芳 - 相爱很难_clip.mp3'
			},
			{
				title: '风中有朵雨做的云',
				artist: '风中有朵雨做的云',
				album: '孟庭苇 - 风中有朵雨做的云 (Live)_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/孟庭苇 - 风中有朵雨做的云 (Live)_clip.mp3'
			},
			{
				title: '生如夏花',
				artist: '生如夏花',
				album: '朴树 - 生如夏花 + 平凡之路 (Live)_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/朴树 - 生如夏花 + 平凡之路 (Live)_clip.mp3'
			},
			{
				title: '独家记忆',
				artist: '独家记忆',
				album: '乔任梁 - 独家记忆 (Live).mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/乔任梁 - 独家记忆 (Live).mp3'
			},
			{
				title: '快活',
				artist: '快活',
				album: '曲婉婷 - 快活_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/曲婉婷 - 快活_clip.mp3'
			},
			{
				title: '没有什么不同',
				artist: '没有什么不同',
				album: '曲婉婷 - 没有什么不同 (Live)_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/曲婉婷 - 没有什么不同 (Live)_clip.mp3'
			},
			{
				title: '我的歌声里',
				artist: '我的歌声里',
				album: '曲婉婷 - 我的歌声里 (Live)_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/曲婉婷 - 我的歌声里 (Live)_clip.mp3'
			},
			{
				title: '花好月圆夜',
				artist: '花好月圆夜',
				album: '任贤齐 - 花好月圆夜_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/任贤齐 - 花好月圆夜_clip.mp3'
			},
			{
				title: '星语心愿',
				artist: '星语心愿',
				album: '任贤齐 - 星语心愿_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/任贤齐 - 星语心愿_clip.mp3'
			},
			{
				title: '斑马斑马',
				artist: '斑马斑马',
				album: '宋冬野 - 斑马，斑马_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/宋冬野 - 斑马，斑马_clip.mp3'
			},
			{
				title: ' 好日子',
				artist: ' 好日子',
				album: '宋祖英 - 好日子_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/宋祖英 - 好日子_clip.mp3'
			},
			{
				title: '洪湖水浪打浪',
				artist: '洪湖水浪打浪',
				album: '宋祖英 - 洪湖水浪打浪_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/宋祖英 - 洪湖水浪打浪_clip.mp3'
			},
			{
				title: '辣妹子',
				artist: '辣妹子',
				album: '宋祖英 - 辣妹子_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/宋祖英 - 辣妹子_clip.mp3'
			},
			{
				title: '映山红',
				artist: '映山红',
				album: '宋祖英 - 映山红_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/宋祖英 - 映山红_clip.mp3'
			},
			{
				title: '越来越好',
				artist: '越来越好',
				album: '宋祖英 - 越来越好_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/宋祖英 - 越来越好_clip.mp3'
			},
			{
				title: '我好想你',
				artist: '我好想你',
				album: '苏打绿 - 我好想你 (Live)_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/苏打绿 - 我好想你 (Live)_clip.mp3'
			},
			{
				title: '我最亲爱的',
				artist: '我最亲爱的',
				album: '苏打绿 - 我最亲爱的 (Live)_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/苏打绿 - 我最亲爱的 (Live)_clip.mp3'
			},
			{
				title: '留什么给你',
				artist: '留什么给你',
				album: '孙楠 - 留什么给你_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/孙楠 - 留什么给你_clip.mp3'
			},
			{
				title: '美丽的神话',
				artist: '美丽的神话',
				album: '孙楠 - 美丽的神话_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/孙楠 - 美丽的神话_clip.mp3'
			},
			{
				title: '你快回来',
				artist: '你快回来',
				album: '孙楠 - 你快回来_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/孙楠 - 你快回来_clip.mp3'
			},
			{
				title: '拯救',
				artist: '拯救',
				album: '孙楠 - 拯救_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/孙楠 - 拯救_clip.mp3'
			},
			{
				title: '红日',
				artist: '红日',
				album: '谭咏麟 - 红日 (Live)_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/谭咏麟 - 红日 (Live)_clip.mp3'
			},
			{
				title: '一念之间',
				artist: '一念之间',
				album: '陶喆 - 一念之间_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/陶喆 - 一念之间_clip.mp3'
			},
			{
				title: '风雨彩虹铿锵玫瑰',
				artist: '风雨彩虹铿锵玫瑰',
				album: '田震 - 风雨彩虹铿锵玫瑰_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/田震 - 风雨彩虹铿锵玫瑰_clip.mp3'
			},
			{
				title: '怒放的生命',
				artist: '怒放的生命',
				album: '汪峰 - 怒放的生命_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/汪峰 - 怒放的生命_clip.mp3'
			},
			{
				title: '远走高飞',
				artist: '远走高飞',
				album: '王子萱 - 远走高飞_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/王子萱 - 远走高飞_clip.mp3'
			},
			{
				title: '想把我唱给你听',
				artist: '想把我唱给你听',
				album: '王筝 - 想把我唱给你听_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/王筝 - 想把我唱给你听_clip.mp3'
			},
			{
				title: '胆小鬼',
				artist: '胆小鬼',
				album: '夏婉安 - 胆小鬼_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/夏婉安 - 胆小鬼_clip.mp3'
			},
			{
				title: '带你去旅行',
				artist: '带你去旅行',
				album: '校长 - 带你去旅行_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/校长 - 带你去旅行_clip.mp3'
			},
			{
				title: '故乡',
				artist: '故乡',
				album: '许巍 - 故乡 (Live)_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/许巍 - 故乡 (Live)_clip.mp3'
			},
			{
				title: '生活不止眼前的苟且',
				artist: '生活不止眼前的苟且',
				album: '许巍 - 生活不止眼前的苟且_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/许巍 - 生活不止眼前的苟且_clip.mp3'
			},
			{
				title: '丑八怪',
				artist: '丑八怪',
				album: '薛之谦 - 丑八怪_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/薛之谦 - 丑八怪_clip.mp3'
			},
			{
				title: '你还要我怎样',
				artist: '你还要我怎样',
				album: '薛之谦 - 你还要我怎样_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/薛之谦 - 你还要我怎样_clip.mp3'
			},
			{
				title: '消愁',
				artist: '消愁',
				album: '薛之谦 - 消愁 (Live)_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/薛之谦 - 消愁 (Live)_clip.mp3'
			},
			{
				title: '演员',
				artist: '演员',
				album: '薛之谦 - 演员_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/薛之谦 - 演员_clip.mp3'
			},
			{
				title: '暧昧',
				artist: '暧昧',
				album: '薛之谦 - 暧昧_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/薛之谦 - 暧昧_clip.mp3'
			},
			{
				title: '趁早',
				artist: '趁早',
				album: '张惠妹 - 趁早 (Live)_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/张惠妹 - 趁早 (Live)_clip.mp3'
			},
			{
				title: '听海',
				artist: '听海',
				album: '张惠妹 - 听海 (剧场版)_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/张惠妹 - 听海 (剧场版)_clip.mp3'
			},
			{
				title: '我可以抱你吗',
				artist: '我可以抱你吗',
				album: '张惠妹 - 我可以抱你吗 (Live)_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/张惠妹 - 我可以抱你吗 (Live)_clip.mp3'
			},
			{
				title: '爱如潮水',
				artist: '爱如潮水',
				album: '张信哲 - 爱如潮水 (轻流版)_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/张信哲 - 爱如潮水 (轻流版)_clip.mp3'
			},
			{
				title: '精忠报国 ',
				artist: '精忠报国 ',
				album: '张艺兴 - 精忠报国 (Live)_clip.mp3',
				mp3: 'voice/张艺兴 - 精忠报国 (Live)_clip.mp3'
			},
			{
				title: '成都',
				artist: '成都',
				album: '赵雷 - 成都_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/赵雷 - 成都_clip.mp3'
			},
			{
				title: '南方姑娘',
				artist: '南方姑娘',
				album: '赵雷 - 南方姑娘_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/赵雷 - 南方姑娘_clip.mp3'
			},
			{
				title: '大海',
				artist: '大海',
				album: '钟镇涛 - 大海_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/钟镇涛 - 大海_clip.mp3'
			},
			{
				title: '朋友',
				artist: '朋友',
				album: '周华健 - 朋友 (Live)_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/周华健 - 朋友 (Live)_clip.mp3'
			},
			{
				title: '平凡之路',
				artist: '平凡之路',
				album: '周深 - 平凡之路_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/周深 - 平凡之路_clip.mp3'
			},
			{
				title: '追光者',
				artist: '追光者',
				album: '岑宁儿 - 追光者_clip.mp3',
				mp3: 'http://s10.realdtech.com/xws/house-richer/sound-game/voice/岑宁儿 - 追光者_clip.mp3'
			},
			
			
			];

	// Load playlist
	for (var i=0; i<playlist.length; i++){
		var item = playlist[i];
		$('#playlist').append('<li>'+item.artist+' - '+item.title+'</li>');
	}

	var time = new Date(),
		currentTrack = shuffle === 'true' ? time.getTime() % playlist.length : 0,
		trigger = false,
		audio, timeout, isPlaying, playCounts;

	var play = function(){
		audio.play();
		$(".play-btn").addClass("playing");
		timeout = setInterval(updateProgress, 500);
		console.log($(".tag strong").text());
		isPlaying = true;
	}

	var pause = function(){
		audio.pause();
		$('.play-btn').removeClass('playing');
		clearInterval(updateProgress);
		isPlaying = false;
	}

	// Update progress
	var setProgress = function(value){
		/*不限制进度条*/
		var currentSec = parseInt(value%60) < 10 ? '0' + parseInt(value%60) : parseInt(value%60),
			ratio = value / audio.duration * 100;
		$('.timer').html(parseInt(value/60)+':'+currentSec);
		$('.progress .pace').css('width', ratio + '%');
		$('.progress .slider a').css('left', ratio + '%');
	}

	var updateProgress = function(){
		setProgress(audio.currentTime);
	}

	// Progress slider
	$('.progress .slider').slider({step: 0.1, slide: function(event, ui){
		$(this).addClass('enable');
		setProgress(audio.duration * ui.value / 100);
		clearInterval(timeout);
	}, stop: function(event, ui){
		audio.currentTime = audio.duration * ui.value / 100;
		$(this).removeClass('enable');
		timeout = setInterval(updateProgress, 500);
	}});

	// Volume slider
	var setVolume = function(value){
		audio.volume = localStorage.volume = value;
		$('.volume .pace').css('width', value * 100 + '%');
		$('.volume .slider a').css('left', value * 100 + '%');
	}

	var volume = localStorage.volume || 0.5;
	$('.volume .slider').slider({max: 1, min: 0, step: 0.01, value: volume, slide: function(event, ui){
		setVolume(ui.value);
		$(this).addClass('enable');
		$('.mute').removeClass('enable');
	}, stop: function(){
		$(this).removeClass('enable');
	}}).children('.pace').css('width', volume * 100 + '%');

	$('.mute').click(function(){
		if ($(this).hasClass('enable')){
			setVolume($(this).data('volume'));
			$(this).removeClass('enable');
		} else {
			$(this).data('volume', audio.volume).addClass('enable');
			setVolume(0);
		}
	});

	// Switch track
	var switchTrack = function(i){
		if (i < 0){
			track = currentTrack = playlist.length - 1;
		} else if (i >= playlist.length){
			track = currentTrack = 0;
		} else {
			track = i;
		}

		$('audio').remove();
		loadMusic(track);
		if (isPlaying == true) play();
	}

	// Shuffle
	var shufflePlay = function(){
		var time = new Date(),
			lastTrack = currentTrack;
		currentTrack = time.getTime() % playlist.length;
		if (lastTrack == currentTrack) ++currentTrack;
		switchTrack(currentTrack);
	}

	// Fire when track ended
	var ended = function(){
		pause();
		audio.currentTime = 0;
		playCounts++;
		if (continous == true) isPlaying = true;
		if (repeat == 1){
			play();
		} else {
			if (shuffle === 'true'){
				shufflePlay();
			} else {
				if (repeat == 2){
					switchTrack(++currentTrack);
				} else {
					if (currentTrack < playlist.length) switchTrack(++currentTrack);
				}
			}
		}
	}

	var beforeLoad = function(){
		var endVal = this.seekable && this.seekable.length ? this.seekable.end(0) : 0;
		$('.progress .loaded').css('width', (100 / (this.duration || 1) * endVal) +'%');
	}

	// Fire when track loaded completely
	var afterLoad = function(){
		if (autoplay == true) play();
	}

	// Load track
	var loadMusic = function(i){
		var item = playlist[i],
			newaudio = $('<audio>').html('<source src="'+item.mp3+'"><source src="'+item.ogg+'">').appendTo('#player');
		
		$('.cover').html('<img src="'+item.cover+'" alt="'+item.album+'">');
		$('.tag').html('<strong>'+item.title+'</strong><span class="artist">'+item.artist+'</span><span class="album">'+item.album+'</span>');
		$('#playlist li').removeClass('playing').eq(i).addClass('playing');
		audio = newaudio[0];
		audio.volume = $('.mute').hasClass('enable') ? 0 : volume;
		audio.addEventListener('progress', beforeLoad, false);
		audio.addEventListener('durationchange', beforeLoad, false);
		audio.addEventListener('canplay', afterLoad, false);
		audio.addEventListener('ended', ended, false);
	}

	loadMusic(currentTrack);
    var figure=0;//记录连续
	//播放
	$('.play-btn').on('click', function(){
		if ($(this).hasClass('enable')){
			shuffle = localStorage.shuffle = 'false';
			$(this).removeClass('enable');
		} else {
			shuffle = localStorage.shuffle = 'true';
			$(this).addClass('enable');
		}
		if ($(this).hasClass('playing')){
			pause();
		} else {
			play();
			//表单
			$("input").on("blur",function(){
				var currentName=$("#soundName").val();
				console.log(currentName);
				console.log($(".tag strong").text());
				// if(currentName == $(".tag strong").text()){
					//判断歌曲是否正确   然后提交  提交一首歌 后台需要给一个标识

				// }
			});

            $(".submit-btn").on("click",function(){
                var currentName=$("input").val();
                $.ajax({
                    type:"post",
                    url:"/sound/SoundHound",
                    data:{
                        name:currentName,
                        music:$(".tag strong").text(),
                        figure:figure+1,
						openid:$("#openid").val()
                    },
                    async:true,
                    success:function(data){
                    	//提交后清空答题区
                        $("#soundName").val("");
                        console.log(data);
                        if(data.success){
                            //歌词猜对时，进入下一首歌
                            if (shuffle === 'true'){
                               shufflePlay();
                            } else {
                               switchTrack(++currentTrack);
                            }
                            figure++;//次数+1
                            if(data.figure){
                            	//弹框时暂停
                                audio.pause();
                                //猜对5次
                                $(".sound-prize").show();
                                //点击X号隐藏弹窗
                                $(".close-btn").on("click",function () {
                                    $(".sound-prize").hide();
                                    //进入下一首歌
                                    if (shuffle === 'true'){
                                        shufflePlay();
                                    } else {
                                        switchTrack(++currentTrack);
                                    }
                                });
                            }else if(data.big){
                                //弹框时暂停
                                audio.pause();
                                //写入中奖信息
                            	$(".valuep").html(data.valuep);
                            	$(".namep").html(data.namep);
                            	$(".code").html(data.nop);
                            	//猜对N多次
                                $(".sound-prizeall").show();
                                //点击X号隐藏弹窗
                                $(".close-btn").on("click",function () {
                                    $(".sound-prizeall").hide();
                                    //进入下一首歌
                                    if (shuffle === 'true'){
                                        shufflePlay();
                                    } else {
                                        switchTrack(++currentTrack);
                                    }
                                });
							}
                        }else if(data.centre){
                            //完成全部没中奖
                            $(".sound-noprize").show();
                            $(".no-prizecon").show();
                            $(".no-prizecon img").attr("src","http://s10.realdtech.com/xws/house-richer/sound-game/img/bq-2.png");
                            $(".noprize-wordt").show();
                            $(".no-prizecon").show();
                        }else{
                            //猜错
                            figure=0;//连续中奖归零
                            audio.pause();//暂停
                            $(".sound-noprize").show();
                            $(".no-prizecon").show();
                            $(".no-prizecon img").attr("src","http://s10.realdtech.com/xws/house-richer/sound-game/img/bq-1.png");
                            $(".noprize-word").show();
                            $(".noprize-wordt").hide();
                        }
                        console.log(figure)

                        //如果判断大于5道题
                        // $(".sound-prize").show();
                        //如果全部答对题
                        // $(".sound-prizeall").show();
                        //全部答对 奖品领完了
                        // $(".prize-off").show();
                    },
                    error:function(){

                    }
                });
            });
            audio.pause();

		}
	});
	//上一首
	$('.up-btn').on('click', function(){
		if (shuffle === 'true'){
			shufflePlay();
		} else {
			switchTrack(--currentTrack);
		}
	});
	//下一首
	$('.next-btn').on('click', function(){
		if (shuffle === 'true'){
			shufflePlay();
		} else {
			switchTrack(++currentTrack);
		}
	});
	$('#playlist li').each(function(i){
		var _i = i;
		$(this).on('click', function(){
			switchTrack(_i);
		});
	});


})(jQuery);
